<template>
  <div class="outline">
    <div class="main" :style="'background-image: url('+bg+');'">
      <div class="touxiang"><img :src="shareUser.usericon" alt="" /></div>
      <div class="renming">{{shareUser.username}}</div>
      <div class="tuijian" style="color: #fff;margin-bottom: 20px;">给你推荐了一个有趣的公众号</div>
      <div class=""><img src="https://demoee.oss-cn-shanghai.aliyuncs.com/point/1638090415104.jpg" alt="" style="width: 120px;height: 120px;border-radius: 50%;"/></div>
      <div class="cheshi" style="color: #fff;">南京生态环境</div>
      <div class="but"><el-button round @click="openy">关注</el-button></div>
    </div>
    <div class="masklayer" v-show="maskopen" @click="maskLayer"></div>
    <div class="writeshare" @click="maskLayer" v-show="maskopen">
      <div class="rreadey"  :style="'background-image: url('+bg+');'">
        <div class="wenzi">长按识别二维码，进入公众号</div>
        <div class="erweimaimg">
          <img :src="wxcode"alt="" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import request from "@/utils/request";
export default {
  data() {
    return {
      code: 0,
      maskopen: false,
	  shareUser:{},
	  bg:'',
	  wxcode:''
    };
  },
  created(){
	  
  },
  async mounted() {
	  this.code=this.$route.query.shareUserId
	 this.UserId();
	 this.getBg()
	 this.getWXCode()
  },
  methods: {
    openy() {
      this.maskopen = true;
    },
	getWXCode(){
	   request({
	    url: "/generator/image/front/info?id=2",
	    method: "get",
	  }).then((response) => {
		  console.log(response)
		  this.wxcode=response.image.image
	  });
	},
    UserId() {
      let query = { shareUserId: this.code };
      return request({
        url: "generator/userpoints/front/sharepoints",
        method: "get",
        params: query,
      }).then((res) => {
		this.shareUser=res.user
      });
    },
	getBg() {
	  let query = { page: this.code };
	  return request({
	    url: "generator/poster/front/poster",
	    method: "get",
	    params: query,
	  }).then((res) => {
		this.bg=res.poster.backPic
	  });
	},
     maskLayer(){
      console.log('关闭车罩层');
      this.maskopen=false;
    }
  },
};
</script>
<style lang="less" scoped>
.outline {
  padding: 20px;
  position: relative;
  min-height: 100vh;
}
.main {
  border: 1px solid #ddd;
  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  text-align: center;
  padding: 25px 0 40px;
}
.touxiang>img {
	width: 80px;
	height: 80px;
	border-radius: 50%;
  // border: 1px solid red;
}
.but {
  // border: 1px solid red;
  text-align: center;
  margin-top: 25px;
  /deep/.el-button.is-round {
    padding: 12px 130px;
    background: #ff9500;
    color: #ffff;
  }
}
.renming {
  font-weight: bold;
  font-size: 20px;
  color: #fff;
  padding: 10px 0;
  margin-bottom: 20px;
}
.tuijan {
  padding: 10px 0;
  color: #707070;
}
.cheshi {
  padding: 20px;
  color: #707070;
}
.masklayer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  background: #303030;
  opacity: 0.32;
}
.writeshare {
  position: absolute;
  top: calc(50% - 200px);
  left: calc(50% - 140px);
  z-index: 200;
  // width: 100%;
  // height: 100%;
  width: 280px;
  height: 400px;
  // padding: 150px 50px;
  // display: flex;
  // justify-content: flex-end;
}
.main{
	// background-image: url("../../../assets/backyue.jpg");
	background-size: 100% 100%;
}
.rreadey {
	// background-size: 100% 100%;
  // background: white;
  border: 2px solid green;
  background-size: 100% 100%;
  border-radius: 20px;
  width: 280px;
  height: 400px;
}
.erweimaimg {
	width: 120px;
	height: 120px;
	position: absolute;
	top: calc(50% - 60px);
	left: calc(50% - 60px);
  img {
    width: 100%;
  }
}
.wenzi {
  text-align: center;
  padding-top: 20px;
  color: white;
  // font-weight: bold;
  font-size: 16px;
}
</style>